import math
import pickle
class Shape:
    def __init__(self,lenght=0,width=0,height=0,radius=0,bottom=0):
        self.lenght=lenght
        self.width=width
        self.height=height
        self.radius=radius
        self.bottom=bottom
    #def area
class Rectangle(Shape):
    def __init__(self,lenght=0,width=0,height=0):
        super().__init__(lenght=lenght,width=width,height=height)
        # super().height
        # super().lenght
    def rectangle_area(self):
        return self.width * self.height * self.lenght
class Triangle(Shape):
    def __init__(self,height=0,bottom=0):
        super().__init__(height=height,bottom=bottom)
        # super().height
    def triangle_area(self):
        return self.bottom * self.height /2
class Round(Shape):
    def __init__(self,bottom):
        super().__init__(bottom=bottom)
    def round_area(self):
        #math.pi * (self.bottom ** 2)
        return math.pi*(self.bottom**2)
# triangle=Triangle()
# print(triangle.__dict__)
rectangle=Rectangle(lenght=1,width=2,height=3)
print(rectangle.rectangle_area())
triangle=Triangle(height=1,bottom=2)
print(triangle.triangle_area())
round=Round(bottom=4)
print(round.round_area())
print(pickle.dumps(round.round_area())) #序列化为byte对象


# Shape为什么要确定变量的个数呢，如果有多边形呢，可以用子类重写来实现，Shape只是个基类，没必要圈定装多少数据
